﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VulnDBExplorer.Services {
	public interface IFileComparator {
		FileCompareResult compare(string lfile, string rfile);
	}

	public class FileCompareResult {

		public struct FileChunk {

			public static FileChunk Empty = new FileChunk();

			public char Op;
			public int Begin;
			public int End;

			public override string ToString() {
				return string.Format("{0}:{1}-{2}", Op, Begin, End);
			}

			public void set(int begin, int end) {
				this.Begin = begin;
				this.End = end;
			}
		}

		public string LeftFile { get; private set; }
		public string RightFile { get; private set; }
		public List<FileChunk> LeftChange { get; private set; }
		public List<FileChunk> RightChange { get; private set; }

		public FileCompareResult(string lfile, string rfile) {
			LeftChange = new List<FileChunk>();
			RightChange = new List<FileChunk>();
			LeftFile = lfile;
			RightFile = rfile;
		}
	}
}
